package com.xingkeduo.business.operation.json;

import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xingkeduo.util.pojo.base.BaseJson;

/**
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/4/22 20:14
 **/
public class BaseDTOJTO extends BaseJson {


	
	/**
	 * 处理成功返回json格式的数据  
	 * @param content
	 * @return
	 */
	public static ObjectNode toSuccessJson(ObjectNode content) {
		ObjectNode root = MAPPER.createObjectNode();
		root.put("error", 0);
		root.put("reason", "0");
		root.put("content", content);
		return root;
	}
	
    
	/**
	 * 处理失败返回json格式的数据  
	 * @param content
	 * @return
	 */
	public static ObjectNode toErrorJson(String reason) {
		ObjectNode root = MAPPER.createObjectNode();
		root.put("error", -1);
		root.put("reason", reason);
		root.put("content", "");
		return root;
	}
}
